using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;

// Help File : HealthCare-ReportDocumentation.txt

public partial class _Default : System.Web.UI.Page 
{

    Manager mgr = new Manager(true,"ConnectionString");
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
           
            
            FetchData();

        }
    }
    
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
       
        FetchData();
    }
    protected void FetchData()
    {

        SqlDataReader drRep;
        SqlParameter[] sp_Array = new SqlParameter[2];

        if (txtdate.Text.Trim().Length == 0)
        {
            
            txtdate.Text = String.Format("{0:MM/dd/yyyy}", DateTime.Today).Replace('-', '/');
        }
        sp_Array[0] = new SqlParameter("@EntryDt", SqlDbType.Char);
        sp_Array[1] = new SqlParameter("@FBflag", SqlDbType.Char);
        sp_Array[0].Size = 10;
        sp_Array[1].Size = 1;

        sp_Array[0].Value = txtdate.Text.Trim(); 
        sp_Array[1].Value = 'F';

        drRep = mgr.ExecuteQuery("sp_SiteAnalytics", sp_Array);

        BindValues(drRep);

    }
    protected void BindValues(SqlDataReader drRep)
    {
        if (drRep.HasRows)
        {
            drRep.Read();
         
                lblDAPR.Text = drRep.GetValue(0).ToString();
                lblDAPM.Text = drRep.GetValue(1).ToString();
                lblDAPW.Text = drRep.GetValue(2).ToString();
                lblDAPD.Text = drRep.GetValue(3).ToString();

                lblDNPR.Text = drRep.GetValue(4).ToString();
                lblDNPM.Text = drRep.GetValue(5).ToString();
                lblDNPW.Text = drRep.GetValue(6).ToString();
                lblDNPD.Text = drRep.GetValue(7).ToString();

                lblDER.Text = drRep.GetValue(8).ToString();
                lblDEM.Text = drRep.GetValue(9).ToString();
                lblDEW.Text = drRep.GetValue(10).ToString();
                lblDED.Text = drRep.GetValue(11).ToString();

                lblUNPR.Text = drRep.GetValue(12).ToString();
                lblUNPM.Text = drRep.GetValue(13).ToString();
                lblUNPW.Text = drRep.GetValue(14).ToString();
                lblUNPD.Text = drRep.GetValue(15).ToString();

                lblUPRR.Text = drRep.GetValue(16).ToString();
                lblUPRM.Text = drRep.GetValue(17).ToString();
                lblUPRW.Text = drRep.GetValue(18).ToString();
                lblUPRD.Text = drRep.GetValue(19).ToString();
                lblMsg.Text = drRep.GetValue(20).ToString();
          
        }
        
    }
    
}


